package com.okq.entity;

import com.okq.entity.base.DataEntity;
import org.apache.commons.lang.StringUtils;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * 描述 : 工单产品表实体类
 * 作者 : zdl
 * 日期 : 2017/6/27 17:22
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "tb_job_product")
public class JobProduct extends DataEntity implements Serializable {
    private static final long serialVersionUID = -5588683821249317261L;
    /**
     * 工单Id
     */
    @Column(name = "jobId", length = 40)
    private String jobId;
    /**
     * 产品编号
     */
    @Column(name = "productCode", length = 40)
    private String productCode;

    /**
     * 问题描述
     */
    @Column(name = "problem")
    private String problem;
    /**
     * 解决方案
     */
    @Column(name = "solution")
    private String solution;
    /**
     * 处理人Id
     */
    @Column(name = "dealId" ,length = 40)
    private String dealId;
    /**
     * 处理时间
     */
    @Column(name = "dealTime")
    private String dealTime;

    /**
     * 工单产品状态 0：已受理 1：已派发 2：已办结
     */
    @Column(name = "state")
    private Integer state;

    /* ------------------ 查询条件 ------------------*/

    /**
     * 开始时间
     */
    @Transient
    private String startTime;
    /**
     * 结束时间
     */
    @Transient
    private String endTime;
    /**
     * 工单编号
     */
    @Transient
    private String jobCode;

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public String getProblem() {
        return problem;
    }

    public void setProblem(String problem) {
        this.problem = problem;
    }

    public String getSolution() {
        return solution;
    }

    public void setSolution(String solution) {
        this.solution = solution;
    }

    public String getDealId() {
        return dealId;
    }

    public void setDealId(String dealId) {
        this.dealId = dealId;
    }

    public String getDealTime() {
        if (StringUtils.isNotBlank(dealTime)) {
            dealTime = dealTime.substring(0, (dealTime.lastIndexOf(".")));
        }
        return dealTime;
    }

    public void setDealTime(String dealTime) {
        if (StringUtils.isNotBlank(dealTime)) {
            dealTime = dealTime + ".0";
        }
        this.dealTime = dealTime;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getJobCode() {
        return jobCode;
    }

    public void setJobCode(String jobCode) {
        this.jobCode = jobCode;
    }
}
